package xj.model.uml;

import static xj.model.uml.UMLModelConstants.ATTR_TYPE;

public class Event extends NamedElement {

  public static enum EventType {
      Signal_Event, 
      Call_Event,
      Change_Event,
      Time_Event,
  }

  public Event() {
    this(null);
  }

  public Event(String name) {
    super(name);

    destructable = false;
    preserved = true;
  }

  public EventType getType() {
    return type;
  }

  public void setType(EventType type) {
    this.type = type;
    setAttribute(ATTR_TYPE, type);
  }

  @Override
  public String toString() {
    return name;
  }

  public String toLongString() {
    return "Event: name=" + name  + " type=" + type;
  }

  @Override
  public Object clone() throws CloneNotSupportedException {
    Event a = (Event) super.clone();
    a.setType(type);
    return a;
  }

  protected EventType type;

}
